<template>
  <view class="partOrderCard">
    <view class="header">
      <view class="date">{{ dateStringFilter }}</view>
    </view>
    <view class="content">
      <view class="content_item">
        <view class="label">{{ item.checkName + ":" }}</view>
        <view class="desc" v-if="item.typeStatus!==2">{{ item.workName }}</view>
        <view class="desc" v-if="item.typeStatus==2&&item.problemItemNames&&item.problemItemNames.length">
          <view v-for="(e,i) in item.problemItemNames" :key="i">{{ e }}
            <text v-if="i!==item.problemItemNames.length-1">,</text>
          </view>
        </view>
      </view>
      <!-- 保养 -->
      <view class="content_item" v-if="item.typeStatus == 1">
        <view class="label">保养记录:</view>
        <view class="desc" :style="{ color: statusMap[item.result].color }">{{
          statusMap[item.result].text
        }}</view>
        </view>
        <view v-if="item.recordDataValues&&item.recordDataValues.length">
          <view class="recordBox" v-for="(e,index) in item.recordDataValues" :key="index"> 
            <view class="record_item">
              <view class="label">{{ item.recordDataValues.length==1?'记录':'记录'+index+1 }}:</view>
              <view class="desc"></view>
            </view>
           <view class="remark">{{ e.remarks.val}}</view>
          <view class="imgBox" v-if="e.files.val&&e.files.val.length">
            <image
              v-for="(img, j) in e.files.val"
              :src="img.type=='image'?img.url:'/static/images/video.png'"
              mode=""
              @click="preViewFile(e.files.val,j)"
              :key="j"
            />
          </view>
          </view>
         
        </view>
        <!-- 维修记录 -->
        <view v-if="item.typeStatus == 2||item.typeStatus == 4">
          <view class="content_item" >
          <view class="label">维修记录:</view>
          <view class="desc">{{ item.disposeDesc }}</view>
        </view>
        <view class="imgBox" v-if="item.disposeImgUrl&&item.disposeImgUrl.length">
          <image
              v-for="(img, j) in item.disposeImgUrl"
              :src="img.type=='image'?img.url:'/static/images/video.png'"
              mode=""
              @click="preViewFile(item.disposeImgUrl,j)"
              :key="j"
            />
          </view>
        </view>
        </view>
        
        <!-- 如果是保养 -->
        <!-- <view class="right">
          <view
            class="desc"
            v-if="item.result !== null"
            :style="{ color: statusMap[item.result].color }"
            >{{ statusMap[item.result].text }}</view
          >
          <view class="desc">{{ item.disposeDesc }}</view>
          <view class="imgBox">
            <image
              src="@/static/images/default.png"
              mode=""
              v-for="(item, index) in 8"
              :key="index"
            />
          </view>
        </view> -->
      </view>
    </view>
  
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
		},
	},
	computed: {
		dateStringFilter() {
			if (!this.item) {
				return '';
			} else {
				return this.item.createTime.replaceAll('-', '/');
			}
		},
	},

	data() {
		return {
			statusMap: {
				1: {
					text: '正常',
					color: '#6BC013',
				},
				2: {
					text: '异常',
					color: '#E02020',
				},
				3: {
					text: '无此项',
					color: '#F7B500',
				},
			},
		};
	},
	methods:{
		preViewFile(list, index) {
			this.$previewMedia({
				sources: list,
				current: index,
			});
		},
	}
};
</script>

<style lang="scss" scoped>
.partOrderCard {
  background: #fff;
  border-radius: 8rpx;
  .header {
    border-bottom: 2rpx solid #eeeeee;
    .date {
      height: 68rpx;
      padding: 0 20rpx;
      display: flex;
      align-items: center;
      color: #999999;
      font-size: 24rpx;
    }
  }
  .content {
    padding: 26rpx 20rpx;
    font-size: 26rpx;
    color: #666;
    .content_item {
      display: flex;
      margin-bottom: 16rpx;
      .label {
        margin-right: 26rpx;
        width: 112rpx;
      }
      .desc{
        display: flex;
        flex: 1;
      }
    }
    .imgBox {
      display: flex;
      flex-wrap: wrap;
      image {
        width: 96rpx;
        height: 96rpx;
        margin-right: 22rpx;
        margin-top: 16rpx;
        
      }
    }
  }
}
</style>
